<script lang="ts" setup>
import HomePanel from './home-panel.vue';
import useStore from '@/store/index';
const home = useStore().home;
</script>

<template>
  <div class="home-new" v-if="home.hotRecommends.length > 0">
    <HomePanel
      title="人气推荐"
      sub-title="人气爆款 不容错过"
      style="margin-top: 20px"
    >
      <!-- 面板内容 -->
      <template v-slot:body>
        <ul class="goods-list">
          <li v-for="item in home.hotRecommends" :key="item.id">
            <RouterLink to="/">
              <img :src="item.picture" alt="" />
              <p class="name ellipsis">{{ item.title }}</p>
              <p class="price">&yen;{{ item.alt }}</p>
            </RouterLink>
          </li>
        </ul>
      </template>
    </HomePanel>
  </div>
  <ul class="goods-list" v-else>
    <li v-for="item in 4" :key="item">
      <XtxSkeleton :width="306" :height="406" bg="rgba(255,255,255,0.2)" />
    </li>
  </ul>
</template>

<style scoped lang="less">
.goods-list {
  display: flex;
  justify-content: space-between;
  height: 406px;
  li {
    width: 306px;
    height: 406px;
    background: #fff;
    .hoverShadow();
    img {
      width: 306px;
      height: 306px;
    }
    p {
      font-size: 22px;
      padding: 12px 30px 0 30px;
      text-align: center;
    }
    .price {
      color: #999;
      font-size: 18px;
    }
  }
}
</style>
